/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.srcptit.trainning.thompv.btvn2;
import java.util.Scanner;
/**
 *
 * @author SONY
 */
public class Bai5 {
    public static void main(String[] args)
    {   
        Scanner sc=new Scanner(System.in);
        String s;
        System.out.println("Nhap xau: ");
        s=sc.nextLine();
        int t=s.length(),a=0,b=0,c=0,A=0,B=0,C=0;
        for(int i=0;i<t;i++)
        {
            if(s.charAt(i)=='a') a++;
            if(s.charAt(i)=='b') b++;
            if(s.charAt(i)=='c') c++;
            if(s.charAt(i)=='A') A++;
            if(s.charAt(i)=='B') B++;
            if(s.charAt(i)=='C') C++;
        }
        System.out.println("1.\tCo phan biet chu hoa va thuong:");
           System.out.print("So lan xuat hien cua a: "+a+"\n");
           System.out.print("So lan xuat hien cua b: "+b+"\n");
           System.out.print("So lan xuat hien cua c: "+c+"\n");
           System.out.print("So lan xuat hien cua A: "+A+"\n");
           System.out.print("So lan xuat hien cua B: "+B+"\n");
           System.out.print("So lan xuat hien cua C: "+C+"\n");
        A=0; B=0;C=0;
        s=s.toUpperCase();
        for(int i=0;i<t;i++)
        {
            if(s.charAt(i)=='A') A++;
            if(s.charAt(i)=='B') B++;
            if(s.charAt(i)=='C') C++;
        }
        System.out.println("2.\tKhong phan biet hoa hay thuong:");
        System.out.print("So lan xuat hien cua A: "+A+"\n");
        System.out.print("So lan xuat hien cua B: "+B+"\n");
        System.out.print("So lan xuat hien cua C: "+C+"\n");
    }
}
